#pragma once
#include<iostream>
#include<sys/epoll.h>
#include<unistd.h>
#include<cstring>
#include"log.hpp"


class Epoll
{
    static const int gsize = 256;
public:
    // int epoll_create(int size);
    static int CreateEpoll(int size = gsize)
    {
        int epfd = epoll_create(size);

        return epfd;
    }

    // int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
    static int CtlEpoll(int epfd, int opt, int sock, uint32_t events)
    {
        struct epoll_event eve;
        eve.events = events;
        eve.data.fd = sock;
        return epoll_ctl(epfd,opt,sock,&eve);
    }

    // int epoll_wait(int epfd, struct epoll_event *events,int maxevents, int timeout);
    static int  WaitEpoll(int epfd, struct epoll_event events[], int num, int timeout)
    {
        return epoll_wait(epfd,events,num,timeout);
    }
};